﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ue.Infrastructure.Caching;

namespace Ue.Tests.Infrastructure.Caching
{
    /// <summary>
    /// CacheManager 的摘要说明
    /// </summary>
    [TestClass]
    public class CacheManagerTests
    {
        [TestMethod]
        public void TypeSpecificManager()
        {
            ICacheHolder cacheHolder=new CacheHolder(new CacheContextAccessor());
            ICacheManager intCacheMangaer = new CacheManager(typeof(int), cacheHolder);
            ICacheManager intCacheMangaer2 = new CacheManager(typeof(int), cacheHolder);
            ICacheManager stringCacheMangaer = new CacheManager(typeof(string), cacheHolder);

            var w1 = intCacheMangaer.Get("key", context => new object());
            var w2 = intCacheMangaer.Get("key", context => new object());
            var w3 = stringCacheMangaer.Get("key",context=>new object());

            Assert.AreEqual(w1, w2);
            Assert.AreNotEqual(w1, w3);
        }
    }
}
